<template>
    <div>
        <el-config-provider :locale="messages">
            <NuxtLayout>
                <NuxtPage/>
            </NuxtLayout>
        </el-config-provider>
    </div>
</template>

<script setup lang="ts">
import {useI18n} from 'vue-i18n'
import {initialize} from '~/api/common'
import type {Language} from 'element-plus/es/locale'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
const {locale, getLocaleMessage} = useI18n()
const messages = getLocaleMessage(locale.value) as Language
// 前端初始化请求
await initialize()
const siteConfig = useSiteConfig()
// 根据站点名称设置默认标题模板
useSeoMeta({
    titleTemplate: (titleChunk?: string) => {
        return titleChunk ? `${titleChunk} - ${siteConfig.siteName}` : siteConfig.siteName
    },
    description: (descriptionChunk?: string) => {
        return descriptionChunk ? `${descriptionChunk} - ${siteConfig.siteDescription}` : siteConfig.siteDescription
    },
    keywords: (keywordsChunk?: string) => {
        return keywordsChunk ? `${keywordsChunk}, ${siteConfig.siteKeywords}` : siteConfig.siteKeywords
    },
})
import { ref, onMounted, onUnmounted } from 'vue'
onMounted(()=>{
})
</script>
<style scoped></style>
